
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)

project(signal LANGUAGES C)

include_directories(../common)

set(COMPILE_ALL OFF)

list(APPEND _sources
    ../common/error.c
    ../common/prexit.c
    ../common/lockfile.c
    ../common/setfd.c
    ../common/setfl.c
    ../common/clrfl.c
    ../common/lockreg.c
    ../common/locktest.c
    ../common/tellwait.c
    ../common/daemonize.c
    ../common/servlisten.c
    ../common/servaccept.c
    ../common/cliconn.c
    ../common/sendfd.c
    ../common/senderr.c
    ../common/recvfd.c
    ../common/writen.c
    # ../common/errorl1og.c
    ../common/ptyopen.c
    ../common/ptyfork.c
    ../common/ttymodes.c
    ../common/spipe.c
    ../common/signalintr.c
    02_driver.c
    03_loop.c

)

if (COMPILE_ALL)
add_executable(pollmsg 02_pollmsg.c ${_sources})
add_executable(sendmsg 03_sendmsg.c ${_sources})
add_executable(bindunix 04_bindunix.c ${_sources})
add_executable(open open/open.c open/main.c ${_sources})
add_executable(opend opend/main.c opend/cliargs.c opend/client.c opend/loop.select.c opend/request.c ${_sources})

else()
add_executable(main 01_main.c ${_sources})
endif()
